package com.ucenter.client.bizbase.sys.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.monitor.api.ApiInfo;
import com.monitor.api.ApiParam;
import com.monitor.api.ApiRes;
import com.ms.client.bizbase.sys.pojo.SysDictType;
import com.ms.client.bizbase.sys.service.SysDictTypeService;
import com.ms.msclient.MsClientResponse;
import com.system.handle.model.ResponseCode;

/**
 * 字典的操作
 * @author yuejing
 * @date 2016-05-22 11:17:54
 * @version V1.0.0
 */
@RestController
public class SysDictTypeController {

	private static final Logger LOGGER = LoggerFactory.getLogger(SysDictTypeController.class);
	@Autowired
	private SysDictTypeService sysDictTypeService;

	/**
	 * 获取对象
	 * @param params
	 * @return
	 */
	@RequestMapping(name = "字典类型-字典获取对象", value = "/sysDictType/get")
	@ApiInfo(params = {
			@ApiParam(name="编码", code="code", clazz=String.class, value="GENDER"),
	},
	response = {
			@ApiRes(name="响应码", code="code", clazz=String.class, value="0"),
			@ApiRes(name="响应消息", code="message", clazz=String.class, value="success"),
			@ApiRes(name="主体内容", code="body", clazz=Object.class, value=""),
	})
	public MsClientResponse<SysDictType> get(String code) {
		try {
			MsClientResponse<SysDictType> frame = sysDictTypeService.get(code);
			return frame;
		} catch (Exception e) {
			LOGGER.error("处理业务异常: " + e.getMessage(), e);
			return new MsClientResponse<>(ResponseCode.SERVER_ERROR);
		}
	}
}